﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Data.SqlClient;

public partial class ShowNew : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string newTitle = Session["newTitle"].ToString();       
        String sql = "SELECT text,author,date from new where title = '" + newTitle + "'";
        SqlDataReader dataReader = DataBase.ExecuteReader(sql);
        if (dataReader.Read() == false)
        {
            Response.Write("<script>alert(\"此新闻不存在！\")</script>");
            Response.Write("<script>window.close('NewList.aspx')</script>");
            return;
        }
        else
        {
            LabelTitle.Text = newTitle;
            LabelText.Text = dataReader.GetString(0);
            LabelAuthor.Text = dataReader.GetString(1);
            LabelDate.Text = dataReader.GetDateTime(2).ToString().Remove(9);
        }
    }
    protected void returnDefault(object sender, ImageClickEventArgs e)
    {
        Server.Transfer("default.aspx");
    }
}
